import { defineStore } from 'pinia'
import { ref } from 'vue'

//用户模块 token setToken removeToken
export const useUserStore = defineStore(
    'useMemberStore',
    () => {
        //用户信息
        const userInfo = ref( { token:'测试token'})
        const setUserInfo = (data) => {
            userInfo.value = data
        }
        //退出登录时
        const removeUserInfo = () => {
            userInfo.value = {}
        }

        return {
            userInfo,
            setUserInfo,
            removeUserInfo
        }
    },
    {
        persist: true
    }
)
